package com.emergency.engine.controller;


import com.emergency.common.entity.Result;
import com.emergency.common.entity.StatusCode;
import com.emergency.common.util.JwtUtil;
import com.emergency.engine.domain.TimeLine;
import com.emergency.engine.domain.ScenarPart;
import com.emergency.engine.service.RealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lijie on 2019/10/17.
 */
@RestController
@RequestMapping("/real")
@Api(value="实时推演类",description = "实时推演")
public class RealController {

    @Autowired
    private RealService realService;


    @ApiOperation(value = "推演启停接口" ,  notes="控制整个推演系统启停和倍数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scenarId", value = "想定文件", required = true, paramType = "query"),
    })
    @RequestMapping(value = "/deduction",method = RequestMethod.POST)
    public Result deduction(Long scenarId, int status, int rate){
        boolean flag = realService.deductionScenar(scenarId,status,rate);
        return new Result(flag, StatusCode.OK,  "推演成功", "");
    }

    @ApiOperation(value = "推演进度查询接口" ,  notes="推演进度查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scenarId", value = "想定文件", required = true, paramType = "query"),
    })
    @RequestMapping(value = "/progress",method = RequestMethod.GET)
    public Result deduction(Long scenarId){
        TimeLine timeLine=realService.getProgress(scenarId);
        return new Result(true, StatusCode.OK,  "查询成功", timeLine);
    }


}
